package router

import (
	"github.com/gin-gonic/gin"
	"moon-bird-post-mgr/handlers"
)

func KuaYu() gin.HandlerFunc {
	return func(c *gin.Context) {
		c.Writer.Header().Set("Access-Control-Allow-Origin", "*")
	}
}
func Init() *gin.Engine {
	r := gin.Default()
	r.Use(KuaYu())
	r.POST("/add", handlers.Add)
	r.GET("/list", handlers.List)
	r.GET("/delete", handlers.Delete)
	return r
}
